package com.atguigu.day20.homework.h4;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/25 21:21
 * @注释
 */
public class HomeWork04 {
    public static void main(String[] args) {

        PrintNumber number = new PrintNumber();

        new Thread("偶数线程"){
            public void run(){
                while (true) {
                    number.printEven();
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }.start();
        new Thread("奇数线程"){
            public void run(){
                while(true){
                    number.printOdd();
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }.start();




    }
}
